import {
  createStore
} from 'vuex'

export default createStore({
  state: {
    info: 'hello'
  },
  mutations: {
    updateInfo (state, payload) {
      state.info = payload
    }
  },
  actions: {
    updateInfo (context, payload) {
      setTimeout(() => {
        context.commit('updateInfo', payload)
      }, 2000)
    }
  },
  getters: {
    formatInfo (state) {
      return state.info + 'Tom'
    }
  },
  modules: {}
})
